#!/usr/bin/python


class Duck(object):
    """docstring for Duck"""

    def __init__(self, fb, aa):
        self.flybehavior = fb
        self.quackbehavior = aa

    def set_fly_behavior(self, acd):
        '''set flybehavior of duck'''
        self.flybehavior = acd

    def set_quack_behavior(self, quack):
        """ddd"""
        self.quackbehavior = quack

    def performFly(self):
        self.flybehavior.fly()

    def performQuack(self):
        """text"""
        self.quackbehavior.quack()

    def swim(self):
        print 'All ducks can swim...'
        print

    def display(self):
        pass


class FlyBehavior(object):
    # Interafce class: FlyBehavior

    def fly(self):
        return


class FlywithWing(FlyBehavior):

    def fly(self):
        print 'I am flying with wings'
        # print


class FlyNoWay(FlyBehavior):
    '''ddd'''

    def fly(self):
        print 'I cannot fly'

    def fly1(self):
        print 'I cannot fly'


class QuackBehavior(object):

    def quack(self):
        return


class Quack(QuackBehavior):

    def quack(self):
        print 'Quack!'


class Squeak(QuackBehavior):

    def quack(self):
        print 'Squeak'


class MuteQuack(QuackBehavior):

    def quack(self):
        print 'MuteQuack!'


class RedDuck(Duck):
    """docstring for RedDuck"""

    def __init__(self, fb=FlywithWing(), qb=MuteQuack()):
        super(RedDuck, self).__init__(fb, qb)

    def display(self):
        print 'I am a red duck'
        # return


class RubberDuck(Duck):
    """docstring for RubberDuck"""

    def __init__(self, fb=FlyNoWay(), qb=Quack()):
        super(RubberDuck, self).__init__(fb, qb)

    def display(self):
        print 'I am a rubber duck'


def duck_do_sth(aac):
    ''' inite duck'''
    duck_1 = RedDuck()
    duck_1.display()
    duck_1.performFly()
    duck_1.performQuack()
    duck_1.swim()

    duck_1 = RubberDuck()
    duck_1.display()
    duck_1.performFly()
    duck_1.performQuack()
    duck_1.swim()

    print aac

if __name__ == '__main__':
    duck_do_sth('d')
